﻿#ifndef TLVPROJECT_H
#define TLVPROJECT_H

#include <QObject>
#include <QStringList>
#include "../IStore/IStore.h"
#include "TlvDataModelTypeDef.h"

class TlvProject : public IStore<TlvPrjModel>
{
    Q_OBJECT
public:
    explicit TlvProject(QObject *parent = nullptr);

    bool open(const QString& prjPath);
    bool create(const QString& prjPath, const QString& name);
    bool save();
    bool saveAs(const QString& savePath, const QString& name);

    void removeFromRecent(const QString& prjPath);
    void removeFromRecent();
    QString latestProject() const;
    QStringList recentProjects() const;

protected:
    void loadRecentProjects();
    void saveRecent();
    void loadProject();

signals:
    void loading(const QString&);
    void loaded();
    void edited(bool);
    void errorOccurred(const QString&);

private:
    QString m_prjPath;
    QStringList m_recent;
};

#endif // TLVPROJECT_H
